package dal;

import java.io.Serializable;


/**
 * The persistent class for the USERS database table.
 * 
 */
public class User implements Serializable {
	private static final long serialVersionUID = 1L;
		
	private int id;
	private transient String password;
	private String username;
	private boolean isAdministrator;

    public User() {
    }

    public User(String string, String string2) {
		username = string;
		password = string2;
		isAdministrator = false;
	}
    

	public User(String string, String string2,boolean isAdministrator) {
		username = string;
		password = string2;
		this.isAdministrator = isAdministrator;
	}


	//@Id
	//@GeneratedValue(strategy=GenerationType.AUTO)
	public int getId() {
		return this.id;
	}

	


	public String getPassword() {
		return this.password;
	}

	public void setPassword(String password) {
		this.password = password;
	}


	public String getUsername() {
		return this.username;
	}

	public void setUsername(String username) {
		this.username = username;
	}
	
	@Override
	public boolean equals(Object other) {
		if (this == other){
			return true;
		}else if ((null != other) && (other instanceof User)){			
			User otherUser = (User)other;			
			return this.getId() == otherUser.getId();
		}else{
			return false;
		}
	}

	@Override
	public int hashCode() {
		return getId();
	}
	
	public boolean isAdministrator(){
		return isAdministrator;
	}
	
	public void setIsAdministrator(boolean admin){
		isAdministrator = admin;
	}
	
}